<!DOCTYPE HTML>
<link rel="stylesheet" href="editormd/css/editormd.css" />
<link rel="stylesheet" href="http://i.gtimg.cn/vipstyle/frozenui/2.0.0/css/frozen.css">
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<html>
<head>
	<title>三3三博客社区</title>
	<link rel="icon" href="../images/icon.jpg" sizes="32x32">
	<meta charset="utf-8">
	<meta name="renderer" content="webkit|ie-comp|ie-stand">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
	<meta http-equiv="Cache-Control" content="no-siteapp" />
	<LINK rel="Bookmark" href="favicon.ico" >
	<LINK rel="Shortcut Icon" href="../../images/icon.jpg" />	<!--[if lt IE 9]>
	<script type="text/javascript" src="/staticRes/js/html5shiv.js"></script>
	<script type="text/javascript" src="/staticRes/js/respond.min.js"></script>
	<![endif]-->
	<link rel="stylesheet" href="http://i.gtimg.cn/vipstyle/frozenui/2.0.0/css/frozen.css">
	<link rel="stylesheet" type="text/css" href="plugin/h-ui/css/H-ui.min.css" />
	<link rel="stylesheet" type="text/css" href="plugin/Hui-iconfont/1.0.8/iconfont.min.css" />
	<link rel="stylesheet" type="text/css" href="css/common.css" />
	<link rel="stylesheet" type="text/css" href="plugin/pifu/pifu.css" />
	<link rel="stylesheet" type="text/css" href="plugin/wangEditor/css/wangEditor.min.css">
	<link rel="stylesheet" type="text/css" href="editormd/css/editormd.css"/>
	<link rel="stylesheet" type="text/css" href="editormd/css/style.css"/>
	<link rel="stylesheet" href="http://i.gtimg.cn/vipstyle/frozenui/2.0.0/css/frozen.css">
	<link href="/staticRes/lib/h-ui/css/H-ui.ie.css" rel="stylesheet" type="text/css" />
	<script type="application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } function showSide(){$('.navbar-nav').toggle();}</script>
</head>
<body>
<header class="navbar-wrapper">
	<div class="navbar navbar-fixed-top">
		<div class="container cl">
			<a aria-hidden="false" class="nav-toggle Hui-iconfont visible-xs" href="javascript:void(0);" onclick="showSide();">&#xe667;</a>
			<nav class="nav navbar-nav nav-collapse w_menu" role="navigation">
				<ul class="cl">
					<li class="active"> <a href="/main.html" data-hover="主页面">主页面</a> </li>
					<li class="active"> <a href="/blog/list" data-hover="首页">首页</a> </li>
					<li> <a href="about.html" data-hover="关于我">关于我</a> </li>
					<li> <a href="mood.html" data-hover="碎言碎语">碎言碎语</a> </li>
<!--					<li><a href="article.html" data-hover="学无止尽">学无止尽</a></li>-->
					<li> <a href="board.html" data-hover="留言板">留言板</a> </li>
					<li> <a href="writing.html" data-hover="写博客">写博客</a> </li>
					<li> <a href="myBlog.html" data-hover="我的博客">我的博客</a> </li>
				</ul>
			</nav>
			<nav class="navbar-nav navbar-userbar hidden-xs hidden-sm " style="top: 0;">
				<ul class="cl">
					<li class="userInfo dropDown dropDown_hover">
						<!--<a href="javascript:;" ><img class="avatar radius" src="img/40.jpg" alt="丶似浅 "></a>
                        <ul class="dropDown-menu menu radius box-shadow">
                            <li><a href="/app/loginOut">退出</a></li>
                        </ul>-->
						<a href="../login.html" onclick="layer.msg('正在通过QQ登入', {icon:16, shade: 0.1, time:0})" ><img class="avatar size-S" src="img/qq.jpg" title="登入">退出</a>
					</li>
				</ul>
			</nav>
		</div>
	</div>
</header>

<section class="container pt-20">

	<div class="row w_main_row">
		<div style="height: 70px">
			<section class="ui-input-wrap ui-border-t" style="height: 70px">
				<div class="ui-input ui-border-radius" style="height: 50px">
					<input type="text" id="titleText" name="title" value="" placeholder="请输入标题...">
				</div>
				<button class="ui-btn" style="height: 50px;width: 70px" onclick="issue()">发布</button>
			</section>
		</div>

		<div id="test-editormd">
			　　<textarea id="message" name="message" ></textarea>
		</div>

	</div>

</section>

<script src="editormd/js/jquery.min.js"></script>
<script src="editormd/js/editormd.js"></script>
<script src="editormd/editormd.min.js"></script>
<script type="text/javascript">
	var testEditor;
	$(function () {
		testEditor = editormd("test-editormd", {
			placeholder : '  欢迎来到博客创作中心，开始你的创作吧。。。',
			// htmlDecode: "style,script,iframe", //可以过滤标签解码
			width : "100%",
			height : 700,
			// syncScrolling : "single",
			// emoji : true,
			path : "editormd/lib/", //注意2：你的路径
			// saveHTMLToTextarea : true,
			// tocm : true, // Using [TOCM]
			// tex : true, // 开启科学公式TeX语言支持，默认关闭
			// flowChart : true, // 开启流程图支持，默认关闭
			// /* 上传图片配置 */
			imageUpload : true,
			imageFormats : [ "jpg", "jpeg", "gif", "png", "bmp", "webp" ],
			imageUploadURL : "/blog/upload", //注意你后端的上传图片服务地址
		});
	});

	function issue() {
		var title = $("#titleText").val();
		var content = testEditor.getMarkdown();
		// var createDate = new Date().Format("yyyy-MM-dd hh:mm:ss");
		if (title == null || title == "" || title.length <= 1 ){
			alert("标题不能为空")
		}
		$.ajax({
			type:"POST",
			url:"/blog/issue",
			data:{content:content,title:title},
			success: function (data) {
				if (data.code == 200){
					alert(data.data)
					location.href="/blog/list";
				}
				if (data.code == 802){
					alert(data.data)
					window.location.href = "/templates/login.html"
				}
				if (data.error != null){
					alert("系统繁忙，请先将文章保存到草稿箱，稍后再试！！！");
				}
			},
			error: function (data) {
				alert(data.message);
			}
		})
	}

</script>


</body>
</html>
